# encoding=utf8
import sys
reload(sys)
sys.setdefaultencoding('utf8')

class JT_0800:
    result = []
    analysisDescription = ["多媒体数据ID:", "多媒体类型:", "多媒体格式编码:", "事件项编码:", "通道ID:"]
    analysis0800Length = [4,1,1,1,1]


    def LogicAisle(self,protocolStr,header):
        count = 0
        str =""
        for i in range(len(self.analysisDescription)):
            if ( i == 0 or i == 4):
                    str = protocolStr[count:count+(self.analysis0800Length[i] * 2)]
                    header.append(self.analysisDescription[i] + str +"\n");
                    count = count + self.analysis0800Length[i] * 2;
            elif i == 1:
                str = protocolStr[count:count + (self.analysis0800Length[i] * 2)]
                if str == "00":
                    header.append(self.analysisDescription[i] + str + " 图像" + "\n")
                elif str == "01":
                    header.append(self.analysisDescription[i] + str + " 音频" + "\n")
                elif str == "02":
                    header.append(self.analysisDescription[i] + str + " 视频" + "\n")
                count = count + self.analysis0800Length[i] * 2
                # 码流类型
            elif i == 2:
                str = protocolStr[count:count + (self.analysis0800Length[i] * 2)]
                if str == "00":
                    header.append(self.analysisDescription[i] + str + " JPEG" + "\n")
                elif str == "01":
                    header.append(self.analysisDescription[i] + str + " TIF" + "\n")
                elif str == "02":
                    header.append(self.analysisDescription[i] + str + " MP3" + "\n")
                elif str == "03":
                    header.append(self.analysisDescription[i] + str + " WAV" + "\n")
                elif str == "04":
                    header.append(self.analysisDescription[i] + str + " WMV" + "\n")
                count = count + self.analysis0800Length[i] * 2
            elif i == 3:
                str = protocolStr[count:count + (self.analysis0800Length[i] * 2)]
                if str == "00":
                    header.append(self.analysisDescription[i] + str + " 平台下指令" + "\n")
                elif str == "01":
                    header.append(self.analysisDescription[i] + str + " 定时动作" + "\n")
                elif str == "02":
                    header.append(self.analysisDescription[i] + str + " 抢劫报警触发" + "\n")
                elif str == "03":
                    header.append(self.analysisDescription[i] + str + " 碰撞侧翻报警触发" + "\n")
                elif str == "04":
                    header.append(self.analysisDescription[i] + str + " 门开拍照" + "\n")
                elif str == "05":
                    header.append(self.analysisDescription[i] + str + " 门关拍照" + "\n")
                elif str == "06":
                    header.append(self.analysisDescription[i] + str + " 车门由开变关，时速从<20公里到超过20公里" + "\n")
                elif str == "07":
                    header.append(self.analysisDescription[i] + s + " 定距拍照" + "\n")
                count = count + self.analysis0800Length[i] * 2
        self.result = header    
